"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fullscreen = void 0;
function fullscreen(el) {
    if (!fullscreen['listen']) {
        fullscreen['listen'] = true;
        document.addEventListener('keydown', function (e) {
            if (['F11', 'Escape'].includes(e.code)) {
                e.preventDefault();
                e.stopPropagation();
            }
            if (['F11'].includes(e.code)) {
                if (!document.fullscreenElement) {
                    document.body.requestFullscreen();
                }
                else {
                    document.exitFullscreen();
                }
            }
            if (['Escape'].includes(e.code) && document.fullscreenElement) {
                document.exitFullscreen();
            }
        });
    }
    if (document.fullscreenElement) {
        document.exitFullscreen();
        return false;
    }
    else if (el) {
        el.requestFullscreen();
        return true;
    }
}
exports.fullscreen = fullscreen;
